/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package teste;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public final class Log4JConfigurator {

	private static boolean configured = false;

	private static Logger logger = getLogger(Log4JConfigurator.class.getName());

	private static void configure(String nome) {
		/*
		 * if (!configured) { BasicConfigurator.configure(); /* Cria um novo
		 * FileAppender baseado no layout padrão, pré-definido na constante
		 * TTCC_CONVERSION_PATTERN da classe PatternLayout.
		 *
		 * Appender fileAppender = new FileAppender(new PatternLayout(
		 * PatternLayout.DEFAULT_CONVERSION_PATTERN), "hephaestus.log");
		 *
		 * logger = Logger.getLogger(Log4JConfigurator.class);
		 * logger.addAppender(fileAppender); logger.setLevel(Level.DEBUG);
		 * configured = true; }
		 */

		PropertyConfigurator.configure("log4j.properties");
		logger = Logger.getLogger(nome);

	}

	public static Logger getLogger(String nome) {
		configure(nome);
		return logger;
	}
}